#ifndef XABSTRACTSYNTAXTREEPUNCTUATOR_H
#define XABSTRACTSYNTAXTREEPUNCTUATOR_H
#include <astree/xabstractsyntaxtreebuilder.h>
#include <astree/xabstractsyntaxtreevalue.h>

//{
class XAbstractSyntaxTreePunctuatorOpenBrace : public XAbstractSyntaxTreeCreator {
  public:
    XAbstractSyntaxTreePunctuatorOpenBrace() {
        setName(L"{");
    }
  public:
    std::shared_ptr<XAbstractSyntaxTree> create(const XTokenBlock& tokens, uint32_t row, uint32_t col, std::shared_ptr<XAbstractSyntaxTreeBuilder> builder) {
        skipToCol ++;
        auto node = std::make_shared<XAbstractSyntaxTreeValue>(tokens.at(row).tokens.at(col));
        builder->onReceivedPunctuatorOpenBrace(node);
        return node;
    }
};

//}
class XAbstractSyntaxTreePunctuatorCloseBrace : public XAbstractSyntaxTreeCreator {
  public:
    XAbstractSyntaxTreePunctuatorCloseBrace() {
        setName(L"}");
    }
  public:
    std::shared_ptr<XAbstractSyntaxTree> create(const XTokenBlock& tokens, uint32_t row, uint32_t col, std::shared_ptr<XAbstractSyntaxTreeBuilder> builder) {
        skipToCol ++;
        auto node = std::make_shared<XAbstractSyntaxTreeValue>(tokens.at(row).tokens.at(col));
        builder->onReceivedPunctuatorCloseBrace(node);
        return node;
    }
};

//(
class XAbstractSyntaxTreePunctuatorOpenParenthesis : public XAbstractSyntaxTreeCreator {
  public:
    XAbstractSyntaxTreePunctuatorOpenParenthesis() {
        setName(L"(");
    }
  public:
    std::shared_ptr<XAbstractSyntaxTree> create(const XTokenBlock& tokens, uint32_t row, uint32_t col, std::shared_ptr<XAbstractSyntaxTreeBuilder> builder) {
        skipToCol ++;
        auto node = std::make_shared<XAbstractSyntaxTreeValue>(tokens.at(row).tokens.at(col));
        builder->onReceivedPunctuatorOpenParenthesis(node);
        return node;
    }
};

//)
class XAbstractSyntaxTreePunctuatorCloseParenthesis : public XAbstractSyntaxTreeCreator {
  public:
    XAbstractSyntaxTreePunctuatorCloseParenthesis() {
        setName(L")");
    }
  public:
    std::shared_ptr<XAbstractSyntaxTree> create(const XTokenBlock& tokens, uint32_t row, uint32_t col, std::shared_ptr<XAbstractSyntaxTreeBuilder> builder) {
        skipToCol ++;
        auto node = std::make_shared<XAbstractSyntaxTreeValue>(tokens.at(row).tokens.at(col));
        builder->onReceivedPunctuatorCloseParenthesis(node);
        return node;
    }
};

//[
class XAbstractSyntaxTreePunctuatorOpenBracket : public XAbstractSyntaxTreeCreator  {
  public:
    XAbstractSyntaxTreePunctuatorOpenBracket() {
        setName(L"[");
    }
  public:
    std::shared_ptr<XAbstractSyntaxTree> create(const XTokenBlock& tokens, uint32_t row, uint32_t col, std::shared_ptr<XAbstractSyntaxTreeBuilder> builder) {
        skipToCol ++;
        auto node = std::make_shared<XAbstractSyntaxTreeValue>(tokens.at(row).tokens.at(col));
        builder->onReceivedPunctuatorOpenBracket(node);
        return node;
    }
};

//]
class XAbstractSyntaxTreePunctuatorCloseBracket : public XAbstractSyntaxTreeCreator  {
  public:
    XAbstractSyntaxTreePunctuatorCloseBracket() {
        setName(L"]");
    }
  public:
    std::shared_ptr<XAbstractSyntaxTree> create(const XTokenBlock& tokens, uint32_t row, uint32_t col, std::shared_ptr<XAbstractSyntaxTreeBuilder> builder) {
        skipToCol ++;
        auto node = std::make_shared<XAbstractSyntaxTreeValue>(tokens.at(row).tokens.at(col));
        builder->onReceivedPunctuatorCloseBracket(node);
        return node;
    }
};

#endif // XABSTRACTSYNTAXTREEPUNCTUATOR_H
